<!DOCTYPE html>
<html class="x-admin-sm">
{include file="common/static" /}
{include file="common/resources" /}
    <body>
        <div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="">首页</a>
                <a href="">房间</a>
                <a>
                    <cite>账单明细</cite>
                </a>
            </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
                <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
            </a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-header">数据统计</div>
                        <div class="layui-card-body ">
                            <ul class="layui-row layui-col-space10 layui-this x-admin-carousel x-admin-backlog">
                                <li class="layui-col-md2 layui-col-xs6">
                                    <a href="javascript:;" class="x-admin-backlog-body">
                                        <h3>房间数量</h3>
                                        <p>
                                            <cite>{$list.count}</cite>
                                        </p>
                                    </a>
                                </li>
                                <li class="layui-col-md2 layui-col-xs6">
                                    <a href="javascript:;" class="x-admin-backlog-body">
                                        <h3>总金额</h3>
                                        <p>
                                            <cite>{$list.income_details}</cite>
                                        </p>
                                    </a>
                                </li>
                                <li class="layui-col-md2 layui-col-xs6">
                                    <a href="javascript:;" class="x-admin-backlog-body">
                                        <h3>总定金</h3>
                                        <p>
                                            <cite>{$list.deposit_record}</cite>
                                        </p>
                                    </a>
                                </li>
                                <li class="layui-col-md2 layui-col-xs6">
                                    <a href="javascript:;" class="x-admin-backlog-body">
                                        <h3>活动优惠</h3>
                                        <p>
                                            <cite>{$list.activity_price}</cite>
                                        </p>
                                    </a>
                                </li>
                                <li class="layui-col-md2 layui-col-xs6">
                                    <a href="javascript:;" class="x-admin-backlog-body">
                                        <h3>会员折扣</h3>
                                        <p>
                                            <cite>{$list.member_price}</cite>
                                        </p>
                                    </a>
                                </li>
                                <li class="layui-col-md2 layui-col-xs6 ">
                                    <a href="javascript:;" class="x-admin-backlog-body">
                                        <h3>房间</h3>
                                        <p>
                                            <cite>{$room_arr}</cite>
                                        </p>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>

                <div class="layui-col-md12">
                    <div class="layui-card" id="a2">
                        <div class="layui-card-body ">
                            <table class="layui-table layui-form">
                                <thead>
                                    <tr>
                                        <th>房间数量</th>
                                        <th>总金额</th>
                                        <th>总定金</th>
                                        <th>活动优惠</th>
                                        <th>会员折扣</th>
                                        <th>应收价格</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td>{$list.count}</td>
                                        <td>{$list.income_details}</td>
                                        <td>{$list.deposit_record}</td>
                                        <td>{$list.activity_price}</td>
                                        <td>{$list.member_price}</td>
                                        <td>{$list.price_receivable}</td>
                                    </tr>
                                </tbody>
                            </table>
                            <input type="hidden" value="{$room_arr}" id="room_arr">
                        </div>
                    </div>
                    <button class="layui-btn" onclick="cancel()">
                        取消入住
                    </button>
                    <button class="layui-btn" onclick="define()">
                        <i class="layui-icon"></i>确认入住
                    </button>
                    <button class="layui-btn"  id="aa">
                        打印票据
                    </button>
                </div>

            </div>
        </div>
    </body>

<script>
    $(document).ready(function(){
        $("#aa").click(function(){
            $("#a2").printArea();
        });
    });
    //取消订单
    function cancel(){
        $.ajax({
            type:"post",
            url: "{:url('home/welcome/cancel_order')}",
            data: {
                room_arr:$('#room_arr').val(),
            },
            success: function(data){
                console.log(data);
                toastr.error(data.msg);
                if(data.code == 100){
                    setTimeout(function () {
                        layer.closeAll();
                        parent.location.reload();
                    },1500);
                }
            }});
    }

    function define() {
        voice('move');
        //右下弹出
        layer.open({
            type: 1
            ,offset: 'rb'
            ,content: '<div style="padding: 20px 80px;">房间入住成功</div>'
            ,btn: '关闭全部'
            ,btnAlign: 'c' //按钮居中
            ,shade: 0 //不显示遮罩
            ,anim: 2
            ,time: 1400
            ,yes: function(){
                layer.closeAll();
            }
        });
        setTimeout(function () {
            window.parent.frames.location.reload();
        },1500);
    }
</script>


</html>